import { createStore } from 'vuex'

export default createStore({
  state: {
    user: window.localStorage.getItem("user"),
    music: []
  },
  mutations: {
    setUser(state, data) {
      state.user = data
      window.localStorage.setItem('user', state.user)
    },
    setPlayMusic(state, data) {
      console.log(data)
      state.music[0] = data
    },
    deleteUser(state) {
      state.user = undefined
      localStorage.removeItem("user")
    }
  },
  actions: {
  }
})
